package Servlet;

import Hbase.Encapsulation;
import Hbase.OutPut;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/student")
public class GetHbaseData extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {


        OutPut outPut=new OutPut();

        List<Encapsulation> list = outPut.getdata();

        req.setCharacterEncoding("UTf-8");
        resp.setCharacterEncoding("UTF-8");


        resp.setContentType("text/html; charset=utf-8");

        req.setAttribute("Student",list);

        req.getRequestDispatcher("/Allstudent.jsp").forward(req,resp);

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}